SUBROUTINE STOP_MODEL_MPI

!use MPI
use MPI_VARIABLES, only : &
& ierr_MPI, parallel, rank_MPI, &
& request_send_2d, request_recv_2d, &
& request_send_3d, request_recv_3d

implicit none

include 'mpif.h'

if (rank_MPI == 0) then
  write(*,*) 'Terminating model by call to STOP_MODEL_MPI'
endif
if (parallel) then
  call FREE_REQUESTS &
  & (request_send_2d, request_recv_2d, &
  &  request_send_3d, request_recv_3d)
  call MPI_FINALIZE(ierr_MPI)
endif
STOP

END SUBROUTINE STOP_MODEL_MPI

